package com.ynunicom.midplatform.common.tree;

import lombok.Getter;
import lombok.Setter;

/**
 * 树形结构  实体类
 *
 * @author duwei
 * @version 2018/5/16 14:08
 */
@Getter
@Setter
public class TreeNode {
    private Long id;
    private Long parentId;
    private String text;
    private Boolean hasChildren;
    private Boolean disabled;
    private Boolean checked;

    private TreeNode() {

    }

    public static TreeNode convert(ITreeNode treeNode) {
        TreeNode node = new TreeNode();
        node.setId(treeNode.getId());
        node.setParentId(treeNode.getParentId());
        node.setText(treeNode.getText());
        node.setHasChildren(treeNode.getHasChildren());
        node.setDisabled(treeNode.isDisabled());
        node.setChecked(treeNode.isChecked());
        return node;
    }
}
